﻿using System;
using System.Collections.Generic;

class BiggerThanTheNeighbours
{
    static bool BiggerThanNeighbours(int[] array, int testNumber)
    {
        if (array[testNumber] > array[testNumber + 1] && array[testNumber] > array[testNumber - 1])
        {
            return true;
        }
        else
        {
            return false;
        }
        
    }
    static void Main()
    {
        Console.WriteLine("Enter the length of the array:");
        int dimention = int.Parse(Console.ReadLine());
        int[] arrayOfInts = new int[dimention];
        for (int index = 0; index < arrayOfInts.Length; index++)
        {
            Console.WriteLine("Enter element {0}",index);
            arrayOfInts[index] = int.Parse(Console.ReadLine());
        }
        Console.WriteLine("Enter position in the array (from 1 to array's lenght - 2) to see if the number at that position is bigger than it's neighbours:");
        int position = int.Parse(Console.ReadLine());
        if (position < 1 || position >= arrayOfInts.Length - 1)
        {
            Console.WriteLine("Invalid input!");
        }
        else
        {
            Console.WriteLine(BiggerThanNeighbours(arrayOfInts, position));
        }
            
    }
}

